﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MixingStation.LTWebService;
using System.Diagnostics;
using Newtonsoft.Json;

namespace MixingStation
{
    public partial class MixingUC : UserControl
    {
        //是否联网状态
        private bool m_IsOnline = true;
        //当前用户
        private userWs m_CurrentUser = null;
        //当前流水号
        //private string m_CurrentSerialCode = "";
        //是否归零
        private bool m_IsZero = false;
        //标识是否有磅单需要打印
        private bool m_IsNeedPrint = false;
        //当前选择的称重方式
        private WeightTypeEnum m_CurrentWeightType = WeightTypeEnum.Auto;
        //当前过磅信息
        private WeightRecordInfo m_MaterialInfo = new WeightRecordInfo();
        //其他参数信息
        private OtherParameter m_OtherParameter = null;
        //过磅类型,默认为采购物资
        private WeightWayEnum m_CurrentWeightWay = WeightWayEnum.Purchase;
        //是否第二次称重
        private bool m_IsSecondWeight = false;

        //收货单位,采购物资为本公司，配置文件中的corpName
        private string m_Receive = "";
        public MixingUC()
        {
            InitializeComponent();
        }

        private void MixingSingleUC_Load(object sender, EventArgs e)
        {

        }

        #region 对外方法
        //初始化
        public void InitMixingSingleUC(userWs currentUser, List<materialWS> materialList, List<supplierWS> supplierList,
            List<placeWS> placeList, List<DirectionInfo> directionList, List<ReceiveInfo> receiveList, VideoParameter videoParameter, GateControlParameter gateParameter,
            InfraRedParameter infraRedParameter, WeightParameter weightParameter, OtherParameter otherParameter)
        {
            m_CurrentUser = currentUser;
            m_OtherParameter = otherParameter;
            //初始化视频
            this.videoControl.InitVideo(videoParameter, gateParameter);
            //初始化红外
            this.infraRedUC.InitInfraRedUC(infraRedParameter);
            //初始化地秤
            this.weightShowUC.InitWeightShowUC(weightParameter);
            //初始化称重信息界面
            this.materielInfoUC.OnShowInfoEvent += materielInfoUC_OnShowInfoEvent;
            this.materielInfoUC.OnShowWeightStatusEvent += materielInfoUC_OnShowWeightStatusEvent;
            this.materielInfoUC.OnIsDefaultTareEvent += materielInfoUC_OnIsDefaultTareEvent;
            //初始化
            this.materielInfoUC.InitMaterialInfoUC(currentUser, materialList, supplierList, placeList, directionList, receiveList, m_OtherParameter.BelongCorpId, m_OtherParameter.DeliveryCodeList);
            this.weightShowUC.WeightTextChangedEvent += weightShowUC_WeightTextChangedEvent;

            Stopwatch sw = new Stopwatch();
            sw.Start();
            //刷新一下未完成的车辆
            RefeshUnCompletedCarCode();
            sw.Stop();
            LogHelper.info("界面开始加载时初始化未完成的车辆信息耗时：" + sw.ElapsedMilliseconds);
        }

        //是否自动除皮
        void materielInfoUC_OnIsDefaultTareEvent(bool isDefaultTare)
        {
            if (!m_IsSecondWeight && isDefaultTare && m_IsOnline)
                rdgWeightWay.Properties.Items[2].Enabled = true;
            else
                rdgWeightWay.Properties.Items[2].Enabled = false;
        }

        public void SetNoUseStatus()
        {
            this.videoControl.SetUnUseVideo();
            this.materielInfoUC.SetNoUseStatus();
            this.rdgWeightWay.Enabled = false;
            this.btnSaveWeight.Enabled = false;
            this.btnPrint.Enabled = false;
            this.btnNext.Enabled = false;
        }

        //设置网络状态
        public void SetNetWorkStatus(bool isOnline)
        {
            m_IsOnline = isOnline;
            this.materielInfoUC.SetNetWorkStatus(isOnline);
            if (m_MaterialInfo.IsDefaultTare)
            {
                //离线状态下无法选择自动除皮
                if (m_CurrentWeightWay == WeightWayEnum.Purchase && !m_IsSecondWeight)
                    rdgWeightWay.Properties.Items[2].Enabled = m_IsOnline;
            }
        }
        #endregion

        #region 事件
        private decimal m_OriginalWeight = 0;
        //
        private object lockObject = new object(); 
        //重量变化事件
        void weightShowUC_WeightTextChangedEvent(object sender, EventArgs e)
        {
            try
            {
                lock (lockObject)
                {
                    decimal currentWeight = weightShowUC.GetCurrentWeight();
                    m_OriginalWeight = currentWeight;
                    if (m_OriginalWeight > 0 && currentWeight <= 0)
                        m_IsZero = true;
                    else if (m_OriginalWeight <= 0 && currentWeight > 0)
                        m_IsZero = false;
                    if (!this.btnSaveWeight.Enabled)
                        return;
                    materielInfoUC.SetCurrentWeight(currentWeight);
                    int way = int.Parse(this.rdgWeightWay.EditValue.ToString());
                    materielInfoUC.RefreshWeightShow(currentWeight, way);
                }
            }
            catch (Exception ex)
            {
                LogHelper.error("实时重量变化异常：" + ex.ToString());
            }     
        }

        //显示错误信息
        void materielInfoUC_OnShowInfoEvent(string txt)
        {
            lblInfo.Text = txt;
        }

        void materielInfoUC_OnShowWeightStatusEvent(string txt)
        {
            if (txt == "第二次称重")
            {
                m_IsSecondWeight = true;
                rdgWeightWay.Properties.Items[2].Enabled = false;
            }
            else
                m_IsSecondWeight = false;
            if (m_CurrentWeightWay == WeightWayEnum.Purchase)
                rdgWeightWay.Properties.Items[3].Enabled = m_IsSecondWeight;
        }
        //称重方式选择变化事件
        private void rdgWeightWay_SelectedIndexChanged(object sender, EventArgs e)
        {
            int way = int.Parse(this.rdgWeightWay.EditValue.ToString());
            if (way == (int)WeightTypeEnum.Auto)
            {
                m_CurrentWeightType = WeightTypeEnum.Auto;
                if (!m_MaterialInfo.IsDefaultTare)
                    this.materielInfoUC.UpdateBuckleWeightShow(false);
                else
                    this.materielInfoUC.UpdateBuckleWeightShow(true);
            }
            else if (way == (int)WeightTypeEnum.OnceWeight)
            {
                m_CurrentWeightType = WeightTypeEnum.OnceWeight;
                this.materielInfoUC.UpdateBuckleWeightShow(true);
            }
            else if (way == (int)WeightTypeEnum.Check)
            {
                m_CurrentWeightType = WeightTypeEnum.Check;
                this.materielInfoUC.UpdateBuckleWeightShow(false);
            }
            else if (way == (int)WeightTypeEnum.Back)
                m_CurrentWeightType = WeightTypeEnum.Back;
            this.materielInfoUC.WeightWay = m_CurrentWeightType;
        }

        private void rdgType_SelectedIndexChanged(object sender, EventArgs e)
        {
            int way = int.Parse(this.rdgType.EditValue.ToString());
            if (way == (int)WeightWayEnum.Purchase)
            {
                m_CurrentWeightWay = WeightWayEnum.Purchase;
                rdgWeightWay.Properties.Items[1].Enabled = false;
                if (m_IsOnline)
                    rdgWeightWay.Properties.Items[2].Enabled = false;
                if (m_IsSecondWeight)
                    rdgWeightWay.Properties.Items[3].Enabled = true;
                this.materielInfoUC.SetOrderEnable(true);
            }
            else if (way == (int)WeightWayEnum.Other)
            {
                m_CurrentWeightWay = WeightWayEnum.Other;
                rdgWeightWay.Properties.Items[1].Enabled = true;
                rdgWeightWay.Properties.Items[2].Enabled = false;
                rdgWeightWay.Properties.Items[3].Enabled = false;
                this.materielInfoUC.SetOrderEnable(false);
            }
            rdgWeightWay.SelectedIndex = 0;
            this.materielInfoUC.PurchaseType = m_CurrentWeightWay;
            RefeshUnCompletedCarCode();
        }
        #endregion

        #region 按钮事件
        //保存重量
        private void btnSaveWeight_Click(object sender, EventArgs e)
        {
            //获取当前重量
            decimal currentWeight = this.weightShowUC.GetCurrentWeight();
            if (!ValidateWeight(currentWeight))
                return;
            //int way = int.Parse(this.rdgWeightWay.EditValue.ToString());
            //materielInfoUC.RefreshWeightShow(currentWeight, way);
            //获取当前称重信息
            m_MaterialInfo = this.materielInfoUC.GetMaterialFormInfo();
            if (!IsValidate(m_MaterialInfo))
                return;

            //联网状态下，第一次称重
            //1、只称重一次（一次称重，采购物资的自动除皮），则直接保存到服务器
            //2、自动配对，保存到服务器成功后，再往本地数据文件保存，上传状态未第一次称重上传，状态为未完结状态，并且获取其SystemId

            //离线状态下，第一次称重
            //1、只称重一次（一次称重，无法自动除皮），将数据保存到本地，上传状态为未上传，状态为完结状态
            //2、自动配对，将数据保存到本地，上传状态为未上传，状态为 未完结状态

            //联网状态下，第二次称重
            //1、第一次称重有网，（即上传状态为第一次称重已上传，且未完结），根据本地数据取出第一次称重数据，更新二次称重数据，
            //保存至服务器，成功后将本地数据删除
            //2、第一次称重无网（即上传状态为未上传，且未完结），根据第一次称重数据，更新二次称重数据，保存至服务器，成功后将本地数据删除

            //离线状态下，第二次称重
            //1、第一次称重有网,更新本地数据，上传状态为第一次称重已上传，完结
            //2、第一次称重无网，更新本地数据，上传状态为未上传，完结
            if (!m_IsSecondWeight)
            {
                m_MaterialInfo.TempWeight = currentWeight;
                if (m_IsOnline)
                {
                    if (DialogResult.Yes != MessageBox.Show(this, "联网状态下第一次称重，是否确认保存？",
                        "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        return;
                    if (!ProcessFirstWeightOnline(currentWeight, ref m_MaterialInfo))
                        return;
                }
                else
                {
                    if (DialogResult.Yes != MessageBox.Show(this, "断网状态下第一次称重，是否确认保存？",
                        "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        return;
                    if (!ProcessFirstWeightUnline(currentWeight, ref m_MaterialInfo))
                        return;
                }
            }
            else
            {
                if (currentWeight > m_MaterialInfo.TempWeight)
                {
                    m_MaterialInfo.GrossWeight = currentWeight;
                    m_MaterialInfo.TareWeight = m_MaterialInfo.TempWeight;
                }
                else
                {
                    m_MaterialInfo.GrossWeight = m_MaterialInfo.TempWeight;
                    m_MaterialInfo.TareWeight = currentWeight;
                }
                if (m_IsOnline)
                {
                    if (DialogResult.Yes != MessageBox.Show(this, "联网状态下第二次称重，是否确认保存？",
                        "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        return;
                    if (!ProcessSecondWeightOnline(currentWeight, ref m_MaterialInfo))
                        return;
                }
                else
                {
                    if (DialogResult.Yes != MessageBox.Show(this, "断网状态下第二次称重，是否确认保存？",
                        "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                        return;
                    if (!ProcessSecondWeightUnline(currentWeight, ref m_MaterialInfo))
                        return;
                }
            }
            m_MaterialInfo.IsPurchase = m_CurrentWeightWay == WeightWayEnum.Purchase ? true : false;

            lblInfo.Text = "重量保存成功！";
            //完结后将打印按钮开启
            if (m_MaterialInfo.IsCompleted)
                this.btnPrint.Enabled = true;
            this.btnSaveWeight.Enabled = false;
            //刷新重量显示值
            this.materielInfoUC.FillWeightInfo(m_MaterialInfo.TempWeight, m_MaterialInfo.GrossWeight, m_MaterialInfo.TareWeight);
        }

        //打印磅单
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (!m_MaterialInfo.IsCompleted)
            {
                MessageBox.Show("称重尚未完结,无法打印！");
                return;
            }
            try
            {
                btnPrint.Enabled = false;
                //设置打印字段，有网情况下修改服务器，无网情况下修改本地
                if (m_IsOnline)
                {
                    WeightRecordInfo printInfo = null;
                    if (m_MaterialInfo.IsPurchase)
                    {
                        //联网时获取信息
                        purchaseCardWS printPurchaseCard = ServerCommonHelper.GetPurchaseCardByID(m_MaterialInfo.SystemId);
                        if (printPurchaseCard == null)
                        {
                            lblInfo.Text = "未获取到ID：" + m_MaterialInfo.SystemId + "采购记录！";
                            return;
                        }
                        printInfo = CommonHelper.ConvertWeightRecordInfo(printPurchaseCard);
                        printInfo.ReceiveName = m_OtherParameter.CorpName;
                    }
                    else
                    {
                        List<WeightRecordInfo> list = new List<WeightRecordInfo>();
                        Dictionary<string, object> dic = new Dictionary<string, object>();
                        dic.Add("id", m_MaterialInfo.SystemId);
                        CGlobal.strSwapJsonData = JsonConvert.SerializeObject(dic);
                        try
                        {
                            list = ServerCommonHelper.GetWeightRecordsByCondition(m_CurrentUser.userame, m_CurrentUser.password);
                            if(list.Count == 0)
                            {
                                lblInfo.Text = "未获取到ID：" + m_MaterialInfo.SystemId + "过磅记录！";
                                return;
                            }
                            printInfo = list[0];
                        }
                        catch (Exception ex)
                        {
                            lblInfo.Text = "根据ID：" + m_MaterialInfo.SystemId + "获取过磅记录异常：" + ex.Message;
                            LogHelper.error("根据ID：" + m_MaterialInfo.SystemId + "获取过磅记录异常：" + ex.Message);
                            return;
                        }
                    }
                    //打印
                    if (!CommonHelper.Print(printInfo, ""))
                    {
                        lblInfo.Text = "完结后打印失败，详细信息请参考日志文件！";
                        return;
                    }
                    //修改打印字段
                    if (m_MaterialInfo.IsPurchase)
                    {
                        using (LTCardAPIServiceClient client = new LTCardAPIServiceClient())
                        {
                            resultWS result = client.setPurchaseCardPrintById(m_MaterialInfo.SystemId);
                            if (!result.isSuccessful)
                            {
                                lblInfo.Text = "完结后修改打印字段失败:" + result.message;
                                return;
                            }
                        }
                    }
                    else
                    {
                        Dictionary<string, object> dic = new Dictionary<string, object>();
                        dic.Add("id", m_MaterialInfo.SystemId);
                        dic.Add("isPrinted", 1);
                        CGlobal.strSwapJsonData = JsonConvert.SerializeObject(dic);
                        try
                        {
                            long systemId = ServerCommonHelper.SaveWeightRecords(m_CurrentUser.userame, m_CurrentUser.password);
                            if (systemId  == -1)
                            {
                                lblInfo.Text = "完结后修改打印字段失败，详细信息请参考日志文件！";
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            lblInfo.Text = "完结后修改打印字段异常：" + ex.Message;
                            LogHelper.error("完结后修改打印字段异常：" + ex.Message);
                            return;
                        }   
                    }
                    m_MaterialInfo.IsPrinted = true;
                }
                else
                {
                    //断网情况下打印无需再去取记录，直接打印
                    if (!CommonHelper.Print(m_MaterialInfo, ""))
                    {
                        lblInfo.Text = "完结后打印失败，详细信息请参考日志文件！";
                        return;
                    }
                    string sql = "update WeightRecords set IsPrinted = " + true + " where SystemId = " + m_MaterialInfo.SystemId;
                    if (!CommonHelper.DoOpreation(sql))
                    {
                        lblInfo.Text = "完结后修改本地打印字段失败，详细信息请参考日志文件！";
                        return;
                    }
                    m_MaterialInfo.IsPrinted = true;
                }
                lblInfo.Text = "打印成功!";
            }
            catch (Exception ex)
            {
                LogHelper.error("打印磅单异常：" + ex.ToString());
            }
        }

        //下一辆
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (m_MaterialInfo.IsCompleted && !m_MaterialInfo.IsPrinted)
            {
                DialogResult dr = MessageBox.Show("磅单尚未打印，是否继续？", "提示", MessageBoxButtons.OKCancel);
                if (dr == DialogResult.Cancel)
                    return;
                m_MaterialInfo.IsCompleted = false;
            }
            if (m_OtherParameter.IsNeedZero)
            {
                if (!m_IsZero)
                {
                    lblInfo.Text = "地秤重量尚未回零,不能点击下一辆!";
                    return;
                }
            }
            materielInfoUC.ClearForm();
            lblInfo.Text = "";
            this.rdgType.SelectedIndex = 0;
            this.rdgWeightWay.SelectedIndex = 0;
            this.btnSaveWeight.Enabled = true;
            m_MaterialInfo = new WeightRecordInfo();
            //每一次刷新一下未完成的车辆
            RefeshUnCompletedCarCode();
        }
        #endregion

        #region 私有方法
        //称重数据验证
        private bool ValidateWeight(decimal currentWeight)
        {
            //判断重量是否稳定
            if (!this.weightShowUC.IsWeightStable())
            {
                lblInfo.Text = "称重未稳定！";
                return false;
            }

            if (currentWeight <= 0 && m_CurrentWeightType != WeightTypeEnum.Back)
            {
                lblInfo.Text = "重量小于等于0,不能称重！";
                return false;
            }
            return true;
        }

        //验证信息
        private bool IsValidate(WeightRecordInfo formInfo)
        {
            if (string.IsNullOrEmpty(formInfo.CarCode))
            {
                lblInfo.Text = "请输入车牌号！";
                return false;
            }
            if (string.IsNullOrEmpty(formInfo.MaterialCode))
            {
                lblInfo.Text = "请选择物料！";
                return false;
            }
            if (string.IsNullOrEmpty(formInfo.SupplierCode))
            {
                lblInfo.Text = "请选择厂商！";
                return false;
            }
            if (string.IsNullOrEmpty(formInfo.DirectionCode))
            {
                lblInfo.Text = "请选择流向！";
                return false;
            }
            return true;
        }

        //处理第一次称重有网保存重量
        private bool ProcessFirstWeightOnline(decimal currentWeight, ref WeightRecordInfo formInfo)
        {
            try
            {
                long systemId = -1;
                formInfo.TempWeight = currentWeight;
                //自动配对需要二次称重
                if ((m_CurrentWeightType == WeightTypeEnum.Auto && !m_MaterialInfo.IsDefaultTare) ||
                    (m_CurrentWeightType == WeightTypeEnum.Check && m_MaterialInfo.IsDefaultTare))
                {
                    //采购物资第一次称重保存服务器
                    if (m_CurrentWeightWay == WeightWayEnum.Purchase)
                    {
                        formInfo.GrossWeight = currentWeight;
                        if (!ProcessFirstPurchaseAutoOnline(formInfo))
                            return false;
                        purchaseCardWS purchaseCard = ServerCommonHelper.GetPurchaseCard(formInfo.CarCode);
                        if (purchaseCard != null)
                            systemId = purchaseCard.id;
                    }
                    else//非采购物资第一次称重保存服务器
                    {
                        systemId = ProcessFirstUnPurchaseAutoOnline(formInfo);
                        if (systemId == -1)
                            return false;
                    }
                    bool isPurchase = m_CurrentWeightWay == WeightWayEnum.Purchase ? true : false;
                    formInfo.FirstWeightTime = DateTime.Now;
                    //存入本地数据文件
                    string sql = "insert into WeightRecords (SystemId, OrderCode, CarCode, MaterialCode, SupplierCode, PlaceCode,"
                        + " DirectionCode, ReceiveCode, TempWeight, GrossWeight, FirstWeightTime, FirstWeightman,"
                        + " UploadStatus, Remark, IsPurchase, IsCompleted) values (" + systemId + ",'"
                        + formInfo.OrderCode + "','" + formInfo.CarCode + "','" + formInfo.MaterialCode + "','"
                        + formInfo.SupplierCode + "','" + formInfo.PlaceCode + "','" + formInfo.DirectionCode + "','" + formInfo.ReceiveCode + "',"
                        + formInfo.TempWeight + "," + formInfo.GrossWeight + ",'" + formInfo.FirstWeightTime.ToString("yyyy-MM-dd HH:mm:ss") + "','" + m_CurrentUser.employeeName + "',"
                        + (int)UploadedEnum.FirstUploaded + ",'" + formInfo.Remark + "'," + isPurchase + "," + false + ")";
                    if (!CommonHelper.DoOpreation(sql))
                    {
                        LogHelper.error("第一次称重数据保存至本地时执行SQL：" + sql + "语句失败.");
                        lblInfo.Text = "第一次称重数据暂保存失败，详细信息请参考日志文件!";
                        return false;
                    }
                }
                //如果是自动除皮的车辆，但选择的是自动配对，则只称重一次
                else if (m_MaterialInfo.IsDefaultTare && m_CurrentWeightType == WeightTypeEnum.Auto)
                {
                    //采购物资自动除皮
                    if (m_CurrentWeightWay == WeightWayEnum.Purchase)
                    {
                        formInfo.GrossWeight = currentWeight;
                        if (!ProcessFirstPurchaseOnceOnline(formInfo))
                            return false;
                    }
                    formInfo.IsCompleted = true;
                }
                //一次称重只有非采购物资有
                else if (m_CurrentWeightType == WeightTypeEnum.OnceWeight)
                {
                    formInfo.FirstWeightman = m_CurrentUser.employeeName;
                    formInfo.FirstWeightTime = DateTime.Now;
                    formInfo.NetWeight = formInfo.GrossWeight - formInfo.TareWeight - formInfo.BuckleWeight;
                    if (!ProcessFirstUnPurchaseOnceOnline(formInfo))
                        return false;
                    formInfo.IsCompleted = true;
                }
            }
            catch (Exception ex)
            {
                LogHelper.error("第一次称重有网保存重量异常：" + ex.ToString());
                lblInfo.Text = "保存重量异常,详细信息请参考日志文件！";
                return false;
            }
            return true;
        }

        //处理采购物资第一次称重（自动配对）联网状态下保存
        private bool ProcessFirstPurchaseAutoOnline(WeightRecordInfo formInfo)
        {
            try
            {
                if (string.IsNullOrEmpty(formInfo.OrderCode))
                {
                    lblInfo.Text = "联网状态下采购订单不能为空!";
                    return false;
                }
                carWS car = null;
                if (!GetCar(formInfo, ref car))
                    return false;
                purchaseCardWS purchaseCard = ServerCommonHelper.CreatePurchaseCard(car, m_CurrentUser, formInfo);
                //为了自动除皮的车辆，但需二次过磅的，赋值该属性，即是否抽检，则不会去自动除皮
                if (m_CurrentWeightType == WeightTypeEnum.Check && m_MaterialInfo.IsDefaultTare)
                {
                    purchaseCard.isCheck = true;
                    purchaseCard.isCheckSpecified = true;
                }
                //历史毛重比较
                decimal weightAverage = ServerCommonHelper.GetPurCarWeightAverage(0, car.id);
                if (weightAverage == -1)
                {
                    lblInfo.Text = "获取历史平均毛重失败,详细信息请参考日志文件!";
                    return false;
                }
                if (weightAverage > 0 && Math.Abs(weightAverage - purchaseCard.grossWeight) > m_OtherParameter.GrossWeightValue)
                {
                    lblInfo.Text = "当前毛重与历史偏差值大于:" + m_OtherParameter.GrossWeightValue + "kg,需管理员确认!";

                    AdminConfirmForm adminForm = new AdminConfirmForm();
                    adminForm.Title = "毛重偏差异常";
                    adminForm.IsOnline = true;
                    adminForm.UserType = "管理员";
                    if (DialogResult.OK != adminForm.ShowDialog())
                        return false;
                    lblInfo.Text = "";
                }
                bool isSuccessful = ServerCommonHelper.SavePurchaseCard(purchaseCard);
                if (!isSuccessful)
                {
                    lblInfo.Text = "保存重量失败,详细信息请参考日志文件!";
                    return false;
                }
            }
            catch (Exception ex)
            {
                lblInfo.Text = "保存时网络异常，详细信息请参考日志文件！";
                LogHelper.error("采购物资第一次称重（自动配对）联网状态下保存时网络异常：" + ex.Message);
                return false;
            }
            return true;
        }

        //处理采购物资第一次称重（自动除皮）联网状态下保存
        private bool ProcessFirstPurchaseOnceOnline(WeightRecordInfo formInfo)
        {
            try
            {
                if (string.IsNullOrEmpty(formInfo.OrderCode))
                {
                    lblInfo.Text = "联网状态下采购订单不能为空!";
                    return false;
                }
                if (formInfo.GrossWeight < (formInfo.TareWeight + formInfo.BuckleWeight))
                {
                    lblInfo.Text = "自动除皮车辆当前毛重小于固定皮重与扣杂之和，不能称重!";
                    return false;
                }
                carWS car = null;
                if (!GetCar(formInfo, ref car))
                    return false;
                purchaseCardWS purchaseCard = ServerCommonHelper.CreatePurchaseCard(car, m_CurrentUser, formInfo);
                //历史毛重比较
                decimal weightAverage = ServerCommonHelper.GetPurCarWeightAverage(0, car.id);
                if (weightAverage == -1)
                {
                    lblInfo.Text = "获取历史平均毛重失败,详细信息请参考日志文件!";
                    return false;
                }
                if (weightAverage > 0 && Math.Abs(weightAverage - purchaseCard.grossWeight) > m_OtherParameter.GrossWeightValue)
                {
                    lblInfo.Text = "当前毛重与历史偏差值大于:" + m_OtherParameter.GrossWeightValue + "kg,需管理员确认!";

                    AdminConfirmForm adminForm = new AdminConfirmForm();
                    adminForm.Title = "毛重偏差";
                    adminForm.IsOnline = true;
                    adminForm.UserType = "管理员";
                    if (DialogResult.OK != adminForm.ShowDialog())
                        return false;
                    lblInfo.Text = "";
                }
                purchaseCard.buckleWeight = formInfo.BuckleWeight;
                purchaseCard.buckleWeightSpecified = true;
                purchaseCard.buckleReasons = formInfo.BuckleReasons;
                bool isSuccessful = ServerCommonHelper.SavePurchaseCard(purchaseCard);
                if (!isSuccessful)
                {
                    lblInfo.Text = "保存重量失败,详细信息请参考日志文件!";
                    return false;
                }
                //自动除皮一次称重后需再次保存，相当于出厂
                purchaseCard = ServerCommonHelper.GetPurchaseCard(formInfo.CarCode);
                purchaseCard.cardState = 4;
                isSuccessful = ServerCommonHelper.SavePurchaseCard(purchaseCard);

                if (!isSuccessful)
                {
                    lblInfo.Text = "保存重量后完结失败,详细信息请参考日志文件!";
                    return false;
                }
                m_MaterialInfo.SystemId = purchaseCard.id;
            }
            catch (Exception ex)
            {
                lblInfo.Text = "保存时网络异常，详细信息请参考日志文件！";
                LogHelper.error("采购物资第一次称重（一次称重和自动除皮）联网状态下保存时网络异常：" + ex.Message);
                return false;
            }
            return true;
        }

        //处理第一次称重无网保存重量
        private bool ProcessFirstWeightUnline(decimal currentWeight, ref WeightRecordInfo formInfo)
        {
            try
            {
                if (m_CurrentWeightWay == WeightWayEnum.Purchase)
                    formInfo.GrossWeight = currentWeight;
                bool isCompleted = m_CurrentWeightType == WeightTypeEnum.Auto ? false : true;
                bool isPurchase = m_CurrentWeightWay == WeightWayEnum.Purchase ? true : false;
                formInfo.FirstWeightTime = DateTime.Now;
                //存入本地数据文件
                string sql = "insert into WeightRecords (SystemId, OrderCode, CarCode, MaterialCode, SupplierCode, PlaceCode,"
                    + " DirectionCode, ReceiveCode, TempWeight, GrossWeight, FirstWeightTime, FirstWeightman, IsCompleted, "
                    + " UploadStatus, Remark, IsPurchase) values (-1,'"
                    + formInfo.OrderCode + "','" + formInfo.CarCode + "','" + formInfo.MaterialCode + "','"
                    + formInfo.SupplierCode + "','" + formInfo.PlaceCode + "','" + formInfo.DirectionCode + "','" + formInfo.ReceiveCode + "',"
                    + formInfo.TempWeight + "," + formInfo.GrossWeight + ",'" + formInfo.FirstWeightTime.ToString("yyyy-MM-dd HH:mm:ss") + "','" + m_CurrentUser.employeeName + "',"
                    + isCompleted + "," + (int)UploadedEnum.UnUploaded + ",'" + formInfo.Remark + "'," + isPurchase + ")";
                if (!CommonHelper.DoOpreation(sql))
                {
                    LogHelper.error("第一次称重离线时数据保存至本地时执行SQL：" + sql + "语句失败.");
                    lblInfo.Text = "第一次称重离线时数据暂保存失败，详细信息请参考日志文件!";
                    return false;
                }
            }
            catch (Exception ex)
            {
                LogHelper.error("第一次称重无网保存重量异常：" + ex.ToString());
                lblInfo.Text = "保存重量异常,详细信息请参考日志文件！";
                return false;
            }
            return true;
        }

        //处理非采购物资第一次称重（自动配对）联网状态下保存
        private long ProcessFirstUnPurchaseAutoOnline(WeightRecordInfo formInfo)
        {
            long systemId = -1;
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("carCode", formInfo.CarCode);
            dic.Add("materialCode", formInfo.MaterialCode);
            dic.Add("materialName", formInfo.MaterialName);
            dic.Add("supplierCode", formInfo.SupplierCode);
            dic.Add("supplierName", formInfo.SupplierName);
            dic.Add("placeCode", formInfo.PlaceCode);
            dic.Add("placeName", formInfo.PlaceName);

            dic.Add("directionCode", formInfo.DirectionCode);
            dic.Add("directionName", formInfo.DirectionName);
            dic.Add("receiveCode", formInfo.ReceiveCode);
            dic.Add("receive", formInfo.ReceiveName);

            dic.Add("tempWeight", formInfo.TempWeight);
            dic.Add("firstWeightTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            dic.Add("firstWeightMan", m_CurrentUser.employeeName);

            dic.Add("remark", formInfo.Remark);
            dic.Add("isCompleted", 0);
            dic.Add("belongCorpId", m_OtherParameter.BelongCorpId);
            CGlobal.strSwapJsonData = JsonConvert.SerializeObject(dic);
            try
            {
                systemId = ServerCommonHelper.SaveWeightRecords(m_CurrentUser.userame, m_CurrentUser.password);
                if (systemId == -1)
                {
                    lblInfo.Text = "非采购物资第一次称重（自动配对）失败，详细信息请参考日志文件！";
                    return -1;
                }
            }
            catch (Exception ex)
            {
                lblInfo.Text = "非采购物资第一次称重（自动配对）时异常:" + ex.Message;
                LogHelper.error("非采购物资第一次称重（自动配对）时异常:" + ex.Message);
                return -1;
            }
            return systemId;
        }

        //处理非采购物资第一次称重（一次称重）联网状态下保存
        private bool ProcessFirstUnPurchaseOnceOnline(WeightRecordInfo formInfo)
        {
            bool isSuccess = false;
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("carCode", formInfo.CarCode);
            dic.Add("materialCode", formInfo.MaterialCode);
            dic.Add("materialName", formInfo.MaterialName);
            dic.Add("supplierCode", formInfo.SupplierCode);
            dic.Add("supplierName", formInfo.SupplierName);
            dic.Add("placeCode", formInfo.PlaceCode);
            dic.Add("placeName", formInfo.PlaceName);
            dic.Add("directionCode", formInfo.DirectionCode);
            dic.Add("directionName", formInfo.DirectionName);
            dic.Add("receiveCode", formInfo.ReceiveCode);
            dic.Add("receive", formInfo.ReceiveName);
            dic.Add("tempWeight", formInfo.TempWeight);
            dic.Add("grossWeight", formInfo.GrossWeight);
            dic.Add("tareWeight", formInfo.TareWeight);
            dic.Add("buckleWeight", formInfo.BuckleWeight);
            dic.Add("buckleReasons", formInfo.BuckleReasons);
            dic.Add("netWeight", formInfo.NetWeight);
            dic.Add("firstWeightTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            dic.Add("firstWeightMan", m_CurrentUser.employeeName);
            dic.Add("lastWeightTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            dic.Add("lastWeightMan", m_CurrentUser.employeeName);
            dic.Add("remark", formInfo.Remark);
            dic.Add("isCompleted", 1);
            dic.Add("belongCorpId", m_OtherParameter.BelongCorpId);

            CGlobal.strSwapJsonData = JsonConvert.SerializeObject(dic);
            try
            {
                long systemId = ServerCommonHelper.SaveWeightRecords(m_CurrentUser.userame, m_CurrentUser.password);
                if (systemId == -1)
                {
                    lblInfo.Text = "非采购物资第一次称重（一次称重）失败，详细信息请参考日志文件！";
                    return false;
                }
            }
            catch (Exception ex)
            {
                lblInfo.Text = "非采购物资第一次称重（一次称重）时异常:" + ex.Message;
                LogHelper.error("非采购物资第一次称重（一次称重）时异常:" + ex.Message);
                return false;
            }
            return isSuccess;
        }

        //处理第二次称重有网保存重量
        private bool ProcessSecondWeightOnline(decimal currentWeight, ref WeightRecordInfo formInfo)
        {
            try
            {
                //采购物资
                if (m_CurrentWeightWay == WeightWayEnum.Purchase)
                {
                    if (string.IsNullOrEmpty(formInfo.OrderCode))
                    {
                        lblInfo.Text = "联网状态下采购订单不能为空!";
                        return false;
                    }
                    if (this.rdgWeightWay.SelectedIndex == 3)
                        formInfo.IsBack = true;
                    if (formInfo.NetWeight <= 0 && !formInfo.IsBack)
                    {
                        lblInfo.Text = "净重小于等于0，请确认是否为退货车辆，若是请勾选退货按钮";
                        return false;
                    }
                    purchaseCardWS purchaseCard = null;
                    //第一次称重有网
                    if (formInfo.UploadStatus == (int)UploadedEnum.FirstUploaded)
                    {
                        purchaseCard = ServerCommonHelper.GetPurchaseCard(formInfo.CarCode);
                        if (purchaseCard == null)
                        {
                            lblInfo.Text = "未获取" + formInfo.CarCode + "采购信息，详细信息请参考日志文件!";
                            return false;
                        }
                        formInfo.SystemId = purchaseCard.id;
                        ServerCommonHelper.UpdatePurchaseCard(m_CurrentUser, formInfo, ref purchaseCard);
                    }
                    else if (formInfo.UploadStatus == (int)UploadedEnum.UnUploaded)//第一次称重无网
                    {
                        carWS car = null;
                        if (!GetCar(formInfo, ref car))
                            return false;
                        purchaseCard = ServerCommonHelper.CreatePurchaseCard(car, m_CurrentUser, formInfo);
                        ServerCommonHelper.UpdatePurchaseCard(m_CurrentUser, formInfo, ref purchaseCard);
                    }
                    //如果退货超出设定值范围，则弹出管理员框 
                    if (formInfo.IsBack && Math.Abs(currentWeight - formInfo.TempWeight) > m_OtherParameter.BackOverWeight)
                    {
                        lblInfo.Text = "退货重量超出设定值范围,需管理员确认!";
                        AdminConfirmForm form = new AdminConfirmForm();
                        form.UserType = "管理员";
                        form.IsOnline = m_IsOnline;
                        form.Title = "退货重量偏差异常";
                        if (DialogResult.OK != form.ShowDialog())
                            return false;
                        lblInfo.Text = "";
                        purchaseCard.tareWeight = purchaseCard.grossWeight;
                        purchaseCard.tareWeightSpecified = true;
                        purchaseCard.buckleWeight = 0;
                        purchaseCard.buckleWeightSpecified = true;
                        purchaseCard.buckleReasons = "";
                    }
                    else if (formInfo.IsBack)
                    {
                        purchaseCard.tareWeight = purchaseCard.grossWeight;
                        purchaseCard.tareWeightSpecified = true;
                        purchaseCard.buckleWeight = 0;
                        purchaseCard.buckleWeightSpecified = true;
                        purchaseCard.buckleReasons = "";
                    }
                    //与皮重库比较
                    if (purchaseCard.car.tare > 0 && Math.Abs(formInfo.TareWeight - purchaseCard.car.tare) > m_OtherParameter.CarWeightValue)
                    {
                        lblInfo.Text = "当前车重与系统车重偏差值大于:" + m_OtherParameter.CarWeightValue + "kg,需管理员确认!";

                        AdminConfirmForm adminForm = new AdminConfirmForm();
                        adminForm.Title = "车重偏差异常";
                        adminForm.IsOnline = true;
                        adminForm.UserType = "管理员";
                        if (DialogResult.OK != adminForm.ShowDialog())
                            return false;
                        lblInfo.Text = "";
                    }
                    if (formInfo.DeliveryWeight > 0 && Math.Abs(formInfo.DeliveryWeight - formInfo.NetWeight) > m_OtherParameter.DeliveryWeightValue)
                    {
                        lblInfo.Text = "入库数量偏差超出设定值范围,需管理员确认!";
                        AdminConfirmForm form = new AdminConfirmForm();
                        form.UserType = "管理员";
                        form.IsOnline = m_IsOnline;
                        form.Title = "入库数量偏差异常";
                        if (DialogResult.OK != form.ShowDialog())
                            return false;
                        lblInfo.Text = "";
                        purchaseCard.deliveryWeight = formInfo.DeliveryWeight;
                        purchaseCard.deliveryWeightSpecified = true;
                    }
                    purchaseCard.isBack = formInfo.IsBack;
                    bool isSuccessful = ServerCommonHelper.SavePurchaseCard(purchaseCard);
                    if (!isSuccessful)
                    {
                        lblInfo.Text = "保存重量失败,详细信息请参考日志文件!";
                        return false;
                    }
                    //完结再保存一次
                    purchaseCard.cardState = 4;
                    isSuccessful = ServerCommonHelper.SavePurchaseCard(purchaseCard);
                    if (!isSuccessful)
                    {
                        lblInfo.Text = "保存重量后完结失败,详细信息请参考日志文件!";
                        return false;
                    }

                }
                else//非采购物资
                {
                    Dictionary<string, object> dic = new Dictionary<string, object>();
                    //第一次称重有网
                    if (formInfo.UploadStatus == (int)UploadedEnum.FirstUploaded)
                    {
                        formInfo.LastWeightTime = DateTime.Now;
                        dic.Add("id", formInfo.SystemId);
                        dic.Add("materialCode", formInfo.MaterialCode);
                        dic.Add("materialName", formInfo.MaterialName);
                        dic.Add("supplierCode", formInfo.SupplierCode);
                        dic.Add("supplierName", formInfo.SupplierName);
                        dic.Add("placeCode", formInfo.PlaceCode);
                        dic.Add("placeName", formInfo.PlaceName);
                        dic.Add("directionCode", formInfo.DirectionCode);
                        dic.Add("directionName", formInfo.DirectionName);
                        dic.Add("receiveCode", formInfo.ReceiveCode);
                        dic.Add("receive", formInfo.ReceiveName);
                        dic.Add("grossWeight", formInfo.GrossWeight);
                        dic.Add("tareWeight", formInfo.TareWeight);
                        dic.Add("buckleWeight", formInfo.BuckleWeight);
                        dic.Add("buckleReasons", formInfo.BuckleReasons);
                        dic.Add("netWeight", formInfo.NetWeight);
                        dic.Add("lastWeightTime", formInfo.LastWeightTime.ToString("yyyy-MM-dd HH:mm:ss"));
                        dic.Add("lastWeightMan", m_CurrentUser.employeeName);
                        dic.Add("remark", formInfo.Remark);
                        dic.Add("isCompleted", 1);
                    }
                    else
                    {
                        formInfo.FirstWeightTime = DateTime.Now;
                        formInfo.LastWeightTime = DateTime.Now;
                        dic.Add("cardCode", formInfo.CarCode);
                        dic.Add("materialCode", formInfo.MaterialCode);
                        dic.Add("materialName", formInfo.MaterialName);
                        dic.Add("supplierCode", formInfo.SupplierCode);
                        dic.Add("supplierName", formInfo.SupplierName);
                        dic.Add("placeCode", formInfo.PlaceCode);
                        dic.Add("placeName", formInfo.PlaceName);
                        dic.Add("directionCode", formInfo.DirectionCode);
                        dic.Add("directionName", formInfo.DirectionName);
                        dic.Add("receiveCode", formInfo.ReceiveCode);
                        dic.Add("receive", formInfo.ReceiveName);
                        dic.Add("tempWeight", formInfo.TempWeight);
                        dic.Add("grossWeight", formInfo.GrossWeight);
                        dic.Add("tareWeight", formInfo.TareWeight);
                        dic.Add("buckleWeight", formInfo.BuckleWeight);
                        dic.Add("buckleReasons", formInfo.BuckleReasons);
                        dic.Add("netWeight", formInfo.NetWeight);
                        dic.Add("firstWeightTime", formInfo.FirstWeightTime.ToString("yyyy-MM-dd HH:mm:ss"));
                        dic.Add("firstWeightMan", m_CurrentUser.employeeName);
                        dic.Add("lastWeightTime", formInfo.LastWeightTime.ToString("yyyy-MM-dd HH:mm:ss"));
                        dic.Add("lastWeightMan", m_CurrentUser.employeeName);
                        dic.Add("remark", formInfo.Remark);
                        dic.Add("isCompleted", 1);
                    }
                    CGlobal.strSwapJsonData = JsonConvert.SerializeObject(dic);
                    try
                    {
                        long systemId = ServerCommonHelper.SaveWeightRecords(m_CurrentUser.userame, m_CurrentUser.password);
                        if (systemId == -1)
                        {
                            lblInfo.Text = "非采购物资第二次称重失败，详细信息请参考日志文件！";
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        lblInfo.Text = "非采购物资第二次称重异常:" + ex.Message;
                        LogHelper.error("非采购物资第二次称重异常:" + ex.Message);
                        return false;
                    }
                }
                //保存成功后删除本地数据
                string delSql = "delete from WeightRecords where CarCode = '" + formInfo.CarCode + "' and IsCompleted = false";
                if (!CommonHelper.DoOpreation(delSql))
                {
                    LogHelper.error("第二次称重数据保存完结后删除本地数据时执行SQL：" + delSql + "语句失败.");
                    lblInfo.Text = "保存重量完结后删除本地数据失败，详细信息请参考日志文件!";
                    return false;
                }
                formInfo.IsCompleted = true;
            }
            catch (Exception ex)
            {
                LogHelper.error("第二次称重有网保存重量异常：" + ex.ToString());
                lblInfo.Text = "保存重量异常,详细信息请参考日志文件！";
                return false;
            }
            return true;
        }

        //处理第二次称重无网保存重量
        private bool ProcessSecondWeightUnline(decimal currentWeight, ref WeightRecordInfo formInfo)
        {
            try
            {
                if (this.rdgWeightWay.SelectedIndex == 3)
                    formInfo.IsBack = true;
                //如果退货超出设定值范围，则弹出管理员框 
                if (formInfo.IsBack && Math.Abs(currentWeight - formInfo.TempWeight) > m_OtherParameter.BackOverWeight)
                {
                    lblInfo.Text = "退货重量超出设定值范围,需管理员确认!";
                    AdminConfirmForm form = new AdminConfirmForm();
                    form.UserType = "管理员";
                    form.IsOnline = false;
                    form.Title = "退货重量超出设定值";
                    if (DialogResult.OK != form.ShowDialog())
                        return false;
                    lblInfo.Text = "";
                    formInfo.TareWeight = formInfo.GrossWeight;
                    formInfo.BuckleWeight = 0;
                    formInfo.BuckleReasons = "";
                }
                else if (formInfo.IsBack)
                {
                    formInfo.TareWeight = formInfo.GrossWeight;
                    formInfo.BuckleWeight = 0;
                    formInfo.BuckleReasons = "";
                }
                decimal deliveryWeight = 0;
                if (m_CurrentWeightWay == WeightWayEnum.Purchase && (formInfo.DeliveryWeight > 0
                    && Math.Abs(formInfo.DeliveryWeight - formInfo.NetWeight) > m_OtherParameter.DeliveryWeightValue))
                {
                    //采购考虑送货重量
                    lblInfo.Text = "送货重量超出设定值范围,需管理员确认!";
                    AdminConfirmForm form = new AdminConfirmForm();
                    form.UserType = "管理员";
                    form.IsOnline = m_IsOnline;
                    form.Title = "送货重量超出设定值";
                    if (DialogResult.OK != form.ShowDialog())
                        return false;
                    lblInfo.Text = "";
                    deliveryWeight = formInfo.DeliveryWeight;
                }
                formInfo.LastWeightTime = DateTime.Now;
                string sql = "update WeightRecords set MaterialCode = '" + formInfo.MaterialCode + "', SupplierCode = '" + formInfo.SupplierCode
                     + "', PlaceCode = '" + formInfo.PlaceCode + "', DirectionCode = '" + formInfo.DirectionCode + "', ReceiveCode ='" + formInfo.ReceiveCode
                     + "', GrossWeight = " + formInfo.GrossWeight + ", TareWeight = " + formInfo.TareWeight
                     + ", BuckleWeight = " + formInfo.BuckleWeight + ", DeliveryWeight = " + deliveryWeight + ", BuckleReasons = '" + formInfo.BuckleReasons
                     + "', NetWeight = " + formInfo.NetWeight + ", LastWeightTime = '" + formInfo.LastWeightTime.ToString("yyyy-MM-dd HH:mm:ss")
                     + "', LastWeightman = '" + m_CurrentUser.employeeName + "',Remark = '" + formInfo.Remark + "',IsBack = " + formInfo.IsBack
                     + ", IsCompleted = " + true
                     + " where CarCode = '" + formInfo.CarCode + "' and IsCompleted = " + false;

                if (!CommonHelper.DoOpreation(sql))
                {
                    LogHelper.error("第二次称重离线时数据保存至本地时执行SQL：" + sql + "语句失败.");
                    lblInfo.Text = "第二次称重离线时数据暂保存失败，详细信息请参考日志文件!";
                    return false;
                }
                formInfo.IsCompleted = true;
            }
            catch (Exception ex)
            {
                LogHelper.error("第二次称重离线时保存重量异常：" + ex.ToString());
                lblInfo.Text = "保存重量异常,详细信息请参考日志文件！";
                return false;
            }
            return true;
        }

        //获取车辆信息
        private bool GetCar(WeightRecordInfo formInfo, ref carWS car)
        {
            try
            {
                car = ServerCommonHelper.GetCar(m_MaterialInfo.CarCode, 2, m_OtherParameter.BelongCorpId);
                if (car == null)
                {
                    lblInfo.Text = "获取车辆信息失败";
                    return false;
                }
                if (car.invalid == false)
                {
                    lblInfo.Text = "该车属于黑名单,禁止入场";
                    return false;
                }
                if (ServerCommonHelper.IsCarIn(car.id))
                {
                    lblInfo.Text = "该车牌号:" + formInfo.CarCode + "已在厂内";
                    return false;
                }
            }
            catch (Exception ex)
            {
                LogHelper.error("获取车辆信息时网络异常：" + ex.Message);
                lblInfo.Text = "网络异常，详细信息请参考日志文件!";
                return false;
            }
            return true;
        }

        //刷新未完结的车辆信息
        private void RefeshUnCompletedCarCode()
        {
            try
            {
                List<string> carCodeList = new List<string>();
                bool isPurchase = m_CurrentWeightWay == WeightWayEnum.Purchase ? true : false;
                string sqlStr = "select CarCode from WeightRecords where IsCompleted = false and IsPurchase = " + isPurchase;
                DataTable recordDT = CommonHelper.DoSelectOpreation(sqlStr);
                if (recordDT != null && recordDT.Rows.Count > 0)
                {
                    foreach (DataRow dr in recordDT.Rows)
                    {
                        string carCodeStr = dr["CarCode"].ToString();
                        if (string.IsNullOrEmpty(carCodeStr))
                            continue;
                        carCodeList.Add(carCodeStr);
                    }
                }
                materielInfoUC.RefreshUnCompletedCarCode(carCodeList);
            }
            catch (Exception ex)
            {
                lblInfo.Text = "刷新未完成的车牌信息异常,详细信息请参加日志文件!";
                LogHelper.error("刷新未完成的车牌信息异常：" + ex.ToString());
            }
        }
        #endregion
    }
}
